package com.treasure.mall.biz.service.core.user;

import com.treasure.mall.biz.base.CrudService;
import com.treasure.mall.biz.entity.user.UserFollowPO;
import com.treasure.mall.biz.entity.user.UserPO;
import org.springframework.data.domain.Page;
import org.springframework.transaction.annotation.Transactional;

/**
 * @author allan
 * @version 1.0.0
 * @date 2020/7/29
 */
public interface UserFollowService extends CrudService<UserFollowPO, Long> {
    @Transactional
    boolean followToggle(UserPO userPO, Long follow);

    /**
     * 我的粉丝
     *
     * @return
     */
    Page<UserFollowPO> followers(Long userId, int pageIndex, int pageSize);

    long followerCount(Long userId);

    /**
     * 我的关注
     *
     * @param userId
     * @param pageIndex
     * @param pageSize
     * @return
     */
    Page<UserFollowPO> follow(Long userId, int pageIndex, int pageSize);

    long followCount(Long userId);

    /**
     * 用户是否关注了某人
     *
     * @param userId
     * @param follow
     * @return
     */
    boolean isFollowed(Long userId, Long follow);
}
